package com.toune.movie.mvp.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.toune.movie.R;
import com.toune.movie.vo.MusicWebSitesVo;

import java.util.List;

public class AdapterMusicWebSets extends BaseQuickAdapter<MusicWebSitesVo, BaseViewHolder> {
    public AdapterMusicWebSets(int layoutResId, @Nullable List<MusicWebSitesVo> data) {
        super(layoutResId, data);
    }

    private int selectPosition;
    public void setSelectPosition(int position){
        selectPosition = position;
        notifyDataSetChanged();
    }
    @Override
    protected void convert(BaseViewHolder helper, MusicWebSitesVo item) {
        TextView textView = helper.getView(R.id.name_tv);
        textView.setText(item.getName());
        if (helper.getLayoutPosition()==selectPosition){
            textView.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
            textView.setBackgroundColor(mContext.getResources().getColor(R.color.colorPrimary));
        }else {
            textView.setTextColor(mContext.getResources().getColor(R.color.white));
            textView.setBackgroundColor(mContext.getResources().getColor(R.color.gray));
        }
    }
}
